<?php

if (!init()) {
  redirect("?action=login");
}
$id = 0;
$guest = false;

if (isset($_GET['uid']) && $_GET['uid'] != $_SESSION['id']) {
  $id = $_GET['uid'];
  $guest = true;
} else {
  $id = $_SESSION['id'];
  $guest = false;
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <meta http-equiv="Content-Type"
        content="text/html; charset=<?= getMessageByKey("default.charset") ?>"/>
  <title><?= getMessageByKey("user.profile.title") ?></title>
  <link rel="stylesheet" href="css/navigation.css">
  <link rel="stylesheet" type="text/css" href="css/menu.css">
  <link rel="stylesheet" type="text/css" href="css/common.css">
  <link rel="stylesheet" type="text/css" href="css/profile.css">
  <script src="resources/jquery.js"></script>
  <script type="text/javascript" src="resources/jquery-ui.js"></script>
  <link rel="stylesheet" href="css/jquery-ui.css" type="text/css" media="all"/>
  <script type="text/javascript">
    $(document).ready(function () {
      $("#infodiv").draggable({
            cursor: 'move',
            containment: 'document'}
      )
    });
  </script>

  <script language="JavaScript">
    function customFormSubmit() {
      $('#maximized_navigation').show();
      $('#galimgform').submit();
    }
  </script>
</head>
<body>
<?php
include_once("menu.php");
?>

<?php

switch ($_GET['page']) {
  case 'img':
    include_once("profile/profile_img.php");
    break;
  case 'sections':
    if (!$guest) {
      include_once("profile/profile_sections.php");
    }
    break;
  case 'stat':
    include_once("profile/profile_stat.php");
    break;
  case 'groups':
    if (!$guest) {
      include_once("profile/profile_groups.php");
    }
    break;
  case 'info':
    if (!$guest) {
      include_once("profile/profile_info.php");
    }
    break;
  case 'settings':
    if (!$guest) {
      include_once("profile/profile_settings.php");
    }
    break;
  case 'gallery':
    include_once("profile/profile_gallery.php");
    break;
  default:
    include_once("profile/profile_img.php");
    break;
}

include_once("profile/profile_stat.php");
?>

<?php
include_once("navigation.php");
?>
</body>
</html>